home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
public
/
radio
/
stations.pl
< prev
next >
Wrap
Perl Script
|
1994-08-01
|
854b
|
29 lines
#!/usr/bin/perl
##
## Find radio stations
##
## (A small subset of the functionality of stations.py for now)
##
## Written by; Jeff Beadles jeff@onion.rain.com
##
# this emulates #! processing on machines that don't support it.
eval "exec /usr/bin/perl -S $0 $*"
if $running_under_some_shell_and_not_perl;
require 'sys/socket.ph';
($name, $aliases, $proto) = getprotobyname('udp');
$this = pack('S n a4 x8' , &AF_INET, 54317, "\0\0\0\0");
socket(S, &AF_INET, &SOCK_DGRAM, $proto) || die "socket: $!";
bind(S, $this) || die "bind: $!";
while (1) {
recv(S, $buf, 1024, 0) || die "recv: $!\n";
chop($buf);
($t_radio,$t_s,$t_name,$t_port,$t_xmit,$t_log,$t_age) = split(/:/,$buf,7);
print "Bogus message '$buf'\n" if ($t_radio ne "radio");
print "Receiving station '$t_name' on port $t_port\n";
}